<section class="as-register-section">
  <h1 class="mb-0 fs-2 text-center">{{ 'customer.register.title' | t }}</h1>

  <form action="{%- render 'account-api-host' -%}/auth/register" method="post" class="as-register-form mt-5" novalidate autocomplete="off">

    {% render 'account-form-error' %}

    {% render 'account-email-password-input', type: 'register' %}

    <div class="form-check form-pristine mt-3 mb-0">
      <input class="input-pristine form-check-input" type="checkbox" name="is_agree" id="agreePolicy" data-pristine-required-message="{{ 'customer.register.policy_uncheck_error' | t }}" required>
      <label for="agreePolicy" class="form-check-label gray-600 small mt-font-offset">
        {{ 'customer.register.privacy_policy_html' | t: rootUrl: routes.root_url }}
      </label>
    </div>

    {% if settings.enable_subscribe %}
      <div class="form-check form-pristine mt-3 mb-0">
        <input class="input-pristine form-check-input as-subscribe-checkbox" type="checkbox" id="isSubscribe">
        <label for="isSubscribe" class="form-check-label gray-600 small mt-font-offset">
          {{ 'customer.register.subscribe_text' | t }}
        </label>
      </div>
    {% endif %}

    <input type="hidden" class="as-source-param" name="source" value="store">
    <input type="hidden" class="as-return-to-param as-update-redirect" name="return_to" value="{{ request.origin | append: '/pages/redirect' }}">
    <input type="hidden" class="as-store-param" name="store" value="{{ shop.permanent_domain | remove: ".myshopify.com" }}">
    <input type="hidden" name="lang" value="en">

    <div class="as-code-error d-none">{{ 'customer.verify.code_invalid' | t }}</div>
    <div class="as-exist-error d-none">{{ 'customer.register.email_taken_error' | t }}</div>
    <div class="as-frequent-error d-none">{{ 'customer.error.too_many_requests' | t }}</div>
    <div class="as-other-error d-none">{{ 'customer.error.other_error' | t }}</div>

    <button type="submit" class="as-submit btn btn-primary as-hidden-tip w-100 mt-4">{{ 'customer.register.submit' | t }}</button>
  </form>

  <div class="mt-4">
    {% render 'account-social-login' %}
  </div>

  <div class="mt-4 small gray-600 text-center">
    {{ 'customer.register.back_to_login_html' | t }}
  </div>

  <form action="{%- render 'account-api-host' -%}/auth/register" id="checkEmailForm" class="as-check-email-form" method="post" novalidate>
    <input type="hidden" name="email" class="as-email-param">
    <input type="hidden" name="is_check" value="1">

    <div class="as-exist-error d-none">{{ 'customer.register.email_taken_error' | t }}</div>
    <div class="as-other-error d-none">{{ 'customer.error.other_error' | t }}</div>
  </form>
  
  <form action="{{ settings.subscribe_api }}" class="as-subscribe-form" method="post" novalidate>
    <input type="hidden" name="email" class="as-email-param">
    {% if settings.store_tag != blank %}
      <input type="hidden" name="tags" value="{{ settings.store_tag }}">
    {% endif %}
    <div class="as-other-error d-none">{{ 'customer.error.other_error' | t }}</div>
  </form>

  {% render 'account-send-code-form', type: 'register' %}
  
</section>